package com.syerit.view
{
	import com.syerit.ApplicationFacade;
	
	import org.puremvc.as3.multicore.interfaces.IMediator;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;

	public class MainAppMediator extends Mediator implements IMediator
	{
		// Cannonical name of the Mediator
        public static const NAME:String = "MainAppMediator";
        
		public function MainAppMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
		}
		
		/**
         * List all notifications this Mediator is interested in.
         * <P>
         * Automatically called by the framework when the mediator
         * is registered with the view.</P>
         * 
         * @return Array the list of Nofitication names
         */

		override public function listNotificationInterests():Array
		{
			return [
			ApplicationFacade.APPLICATION_READY,
			ApplicationFacade.PROXY_LOAD_CONFIG
			];
		}
		
		/**
         * Handle all notifications this Mediator is interested in.
         * <P>
         * Called by the framework when a notification is sent that
         * this mediator expressed an interest in when registered
         * (see <code>listNotificationInterests</code>.</P>
         * 
         * @param INotification a notification 
         */

		override public function handleNotification(notification:INotification):void
		{
			switch ( notification.getName() ) 
            {
                case ApplicationFacade:
                	//app.loader.addEventListener( Loader
                    app.loader.start();
                    break;
            }

		}
		protected function get app():MainApp
		{
			return viewComponent as MainApp
		}
	}
}